Repository navigation
Migration Report - #4310
Migration Report#4310
Conversation
333fred
left a comment
There was a problem hiding this comment.
Overall looks good to me, thanks for the work @brthor. This unblocks dotnet/project-system#507.
| using System.Linq; | ||
| namespace Microsoft.DotNet.ProjectJsonMigration | ||
| { | ||
| public class ProjectMigrationReport |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| public bool AllSucceeded => ! ProjectMigrationReports.Any(p => p.Errors.Any()); | ||
|
|
||
| public MigrationReport MergeReport(MigrationReport otherReport) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| WriteReport(migrationReport); | ||
|
|
||
| return 0; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (projectMigrationReport.Errors.Any()) | ||
| { | ||
| sb.AppendLine($"Project {projectMigrationReport.ProjectName} migration failed ({projectMigrationReport.ProjectDirectory})"); | ||
| sb.AppendLine(string.Join("\n", projectMigrationReport.Errors.Select(e => e.GetFormattedErrorMessage()))); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
| else | ||
| { | ||
| sb.AppendLine($"Project {projectMigrationReport.ProjectName} migration succeeded ({projectMigrationReport.ProjectDirectory})"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| { | ||
| public static string GetProjectName(this ProjectContext projectContext) | ||
| { | ||
| return Path.GetFileNameWithoutExtension(projectContext.GetOutputPaths("_").CompilationFiles.Assembly); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| { | ||
| public static string GetProjectName(this ProjectContext projectContext) | ||
| { | ||
| return Path.GetFileNameWithoutExtension(projectContext.GetOutputPaths("_").CompilationFiles.Assembly); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| public int SucceededProjectsCount => ProjectMigrationReports.Count(p => !p.Errors.Any()); | ||
|
|
||
| public int FailedProjectsCount => ProjectMigrationReports.Count(p => p.Errors.Any()); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| ProjectDirectory = projectDirectory; | ||
| ProjectName = projectName; | ||
| OutputMSBuildProject = outputMSBuildProject; | ||
| Errors = errors ?? Enumerable.Empty<MigrationError>().ToList(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| public List<MigrationError> Errors { get; } | ||
|
|
||
| public List<string> Warnings { get; } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
|
Added changes to also tackle https://github.com/dotnet/cli/issues/4164 |
|
test Windows_NT x64 Release Build |
7a41f26 to
fbaf9a6
Compare
|
test Windows_NT x64 Release Build |


@livarcocc @srivatsn @333fred
/cc @eerhardt @Sridhar-MS @blackdwarf
The migration report including options for outputting to a file or stdout in a user friendly or json format.
Fixes: #4165
Fixes: #4164
Successful Example:
Failure Example: